package com.um.jdy.common.member.entity.model;

import com.um.jdy.common.member.constants.VerificationCodeConstant;
import com.um.jdy.common.member.enums.CodeKey;

/**
 * @Title 缓存发送验证码相关的key
 * @Description
 * @Author renjunwei
 * @Date 2023/2/10 15:20
 */
public class CacheCodeKey {

    // 缓存code
    private String codeKey;

    // 缓存code
    private String sendTimeKey;

    // 当前邮箱发送时间
    private String identitySendTimeKey;

    // 验证码标识
    private CodeKey prefix;

    // 用户身份，手机号或邮箱
    private String identity;

    public CacheCodeKey(CodeKey prefix, String identity) {
        this.prefix = prefix;
        this.identity = identity;
    }

    public String getCodeKey() {
        return prefix.name() + identity;
    }

    public String getSendTimeKey() {
        return prefix.name() + VerificationCodeConstant.SEND_CODE_TIME;
    }

    public String getIdentitySendTimeKey() {
        return prefix.name() + identity + VerificationCodeConstant.SEND_CODE_TIME;
    }
}
